草庐IT

android - 错误 : Execution failed for task \':app:packageDebug\'

全部标签

ruby-on-rails - Devise 在升级 Rails 4.2 时引发错误

当我运行railss时:/Users/galli01anthony/.rvm/gems/ruby-2.1.3/gems/devise-3.2.4/lib/devise/rails/routes.rb:455:in`ensureinwith_devise_exclusive_scope':undefinedmethod`merge!'for#(NoMethodError)当我运行rakedb:reset或db:migrate或db:setup时:rakeaborted!NoMethodError:undefinedmethod`merge!'for# 最佳答案

ruby-on-rails - 如何从 Ruby on Rails 应用程序返回正确的 HTTP 错误代码

我有RoR3.0网络应用程序,它充当OAuthAPI提供程序。现在,在API中,我想向API使用者返回正确的HTTP错误代码。我该怎么做?例子如下:defdestroy_oauth@item=Item.find(params[:id])if(!@item.nil?&&@item.user_id==current_user.id)@item.destroyrespond_todo|format|format.jsformat.xmlendelseraiseActionController::RoutingError.new('Forbidden')endend因此,如果出现错误,我会尝试

ruby - bundler 和错误的 binstubs?

我运行railss或bundleexecrailss并收到此警告:Bundlerisusingabinstubthatwascreatedforadifferentgem.Thisisdeprecated,infutureversionsyoumayneedto`bundlebinstubrails`toworkaroundasystem/bundleconflict.这是什么意思?通过查看bundler站点,我对binstubs的理解是您可以为它们设置可执行文件,因此您可以执行bin/blabla而不是运行bundleexecblabla。所以这个错误是说我的bundler没有设置到

ruby-on-rails - 路由错误 - 未初始化的常量

我无法在Rails3.2.12中解决这个问题,也许我遗漏了什么。config/routes.rbget"home/index"root:to=>"home#index"devise_for:users,:only=>:omniauth_callbacksmatch'users/auth/:provider/callback'=>'authentications#create'match'/auth/:provider/signout'=>'authentications#signout'app/controllers/authentication_controller.rbclassA

ruby-on-rails - 错误 : failed to build gem native extension when installing rails on mac mountian lion os

我最近更新到MountainLion并重新安装了Ruby,但是当我尝试运行测试Rails应用程序时,我收到一条错误消息,指出“我的系统当前未安装Rails”。我按照它说的做,输入sudogeminstallrails并得到:clearedfaster_requirecachesduetonewgeminstall...Successfullyinstalledrails-3.2.71geminstalledInstallingridocumentationforrails-3.2.7...InstallingRDocdocumentationforrails-3.2.7...但是当我检

ruby-on-rails - Rails App 在后台运行长时间任务的最佳实践?

我有一个Rails应用程序,不幸的是,在向Controller发出请求后,它必须进行一些需要一段时间的处理。在Rails中为长时间运行的任务或请求提供反馈或进度的最佳实践是什么?这些Controller方法通常持续60秒以上。我不关心客户端...我计划每隔一秒左右发出一个Ajax请求并显示一个进度指示器。我只是不确定Rails的最佳实践,我要创建一个额外的Controller吗?我能做点什么聪明的事吗?我希望答案集中在仅使用Rails的服务器端。预先感谢您的帮助。编辑:如果重要的话,http请求是针对PDF的。然后我让Rails与Ruport一起生成这些PDF。问题是,这些PDF非常大

ruby-on-rails - 为什么我会收到 bcrypt-ruby gem 安装错误?

尝试安装gemdevise时出错,安装停止于gembcrypt-ruby:$geminstallbcrypt-rubyErrorinstallingbcrypt-ruby:ERROR:Failedtobuildgemnativeextension.我在RVM下使用Ruby运行OSX10.6.7。我重新安装了最新版本的xcode并重新安装了Ruby64位、Rails和所有的gem。 最佳答案 我在OSX10.7.3下安装时遇到了同样的问题。安装gem时,我的错误消息是:Buildingnativeextensions.Thiscoul

ruby - 错误 : Gem bundler is not installed, 首先运行 `gem install bundler`

您好,我一直在尝试安装Rubygem包。收到此消息后,我按照geminstallbundle的说明进行操作,但是当我键入bundle-v时它仍然不起作用。我也打字捆绑并接收/Users/edmundmai/.rvm/bin/bundle所以它存在!!那么为什么它不起作用!我没有得到的神秘$PATH有什么问题吗?(我是菜鸟)。这是我的.bash_profile:PATH=$PATH:~/binexportPATH[[-s"$HOME/.rvm/scripts/rvm"]]&&source"$HOME/.rvm/scripts/rvm"#LoadRVMintoashellsession*a

ruby-on-rails - 使用 `ActiveRecord with_connection do` 和 ActionController::Live 时出现线程错误

主要编辑:自从最初发现此问题后,我已将其缩减为以下内容。我认为现在这是对问题的略微更精确的描述。因此,对OP的评论可能并不完全相关。编辑在rails/puma项目中发布的轻微修改版本:https://github.com/rails/rails/issues/21209,https://github.com/puma/puma/issues/758编辑现在用OSX和Rainbows复制总结:当使用Puma并运行长时间运行的连接时,我一直收到与跨线程的ActiveRecord连接相关的错误。这在消息中表现出来,例如消息类型0x##空闲时从服务器到达和锁定(崩溃)的服务器。设置:Ubunt

Ruby 的异常错误类

您可以创建异常的子类以使其更具描述性,但是您应该如何设置默认的“消息”?classMyErrorepe.messageendbeginraiseMyErrorraiseException=>epe.messageend第一个应该输出'Acustommessage'第二个应该输出'You'vetriggeredaMyError'关于最佳实践有什么建议吗? 最佳答案 定义一个初始化方法,它将消息作为具有默认值的参数。然后使用该消息调用StandardError的初始化方法(使用super)。classMyError